const state = {
  username: "",
  showLogin: false, //  是否显示组件
};

const mutations = {
  setUser(state, data) {
    state.username = data;
  },
  setShowLogin(state, data) {
    state.showLogin = data;
  },
};

const actions = {
  setUser({ commit }, data) {
    commit("setUser", data);
  },
  setShowLogin({ commit }, data) {
    commit("setShowLogin", data);
  },
};

const getters = {
  getUser(state) {
    return state.username;
  },
  getShowLogin(state) {
    return state.showLogin;
  },
};

export default {
  // namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
